#include<iostream>
using namespace std;

template<typename T>
void Swap(T &a,T &b) //Swap函数而不是swap,因为swap函数在std名称空间中
{
	T temp;
	temp = a;
	a = b;
	b = temp;
}

int main()
{
	int a=3,b=4;
	double a1=3.1,b1=4.1;
	cout<<"a = "<<a<<" b = "<<b<<endl;
	cout<<"交换之后";
	Swap(a,b);
	cout<<"a = "<<a<<" b = "<<b<<endl;
	cout<<"a1 = "<<a1<<" b1 = "<<b1<<endl;
	cout<<"交换之后";
	Swap(a1,b1);
	cout<<"a1 = "<<a1<<" b1 = "<<b1<<endl;
	return 0;

}

